package tech.heptagram.staff.cas.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.http.CacheControl;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import java.util.concurrent.TimeUnit;

/**
 * @author zilaiye
 * @date 2017/12/21
 */
@Configuration
public class CasWebConfig extends WebMvcConfigurerAdapter {
    /**
     * 静态资源映射
     */
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {

        registry.addResourceHandler("/casstatic/**")
            .addResourceLocations("classpath:/casstatic/")
            .setCacheControl(CacheControl.maxAge(10, TimeUnit.MINUTES));
    }
}
